﻿/*******************************************************************************
 * Copyright © 2017 FriendStar.Framework 版权所有
 * Author: FZH
 * Description: FriendStar快速开发平台
 * Website：http://www.FriendStar.cn
*********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using SqlSugarRepository;
using FriendStar.Code;
using FriendStar.Domain.Entity.BOM;
using FriendStar.Domain.IRepository.BOM;
using FriendStar.Repository.BOM;

namespace FriendStar.Application.BOM
{
    /// <summary>
	/// 数据表 PLM_CP_WGGX 对应的数据应用功能类。
	/// </summary>
    public class V_PLM_CP_WGGXApp
    {       
        private string UseUnit = Configs.GetValue("UseUnit");

        private IV_PLM_CP_WGGXRepository service = new V_PLM_CP_WGGXRepository();

        public List<V_PLM_CP_WGGXEntity> GetList(string keyword)
        {
            var expression = ExtLinq.True<V_PLM_CP_WGGXEntity>();
            if (!string.IsNullOrEmpty(keyword))
            {
                expression = expression.And(t => t.FDH == keyword);
            }
            return service.FindList(expression);
        }

        public V_PLM_CP_WGGXEntity GetForm(string keyValue)
        {
            var expression = ExtLinq.True<V_PLM_CP_WGGXEntity>();
            if (!string.IsNullOrEmpty(keyValue))
            {
                expression = expression.And(t => t.RID == keyValue);
            }
            return service.FindEntity(expression);
        }

        public V_PLM_CP_WGGXEntity GetItem(string dh)
        {
            var expression = ExtLinq.True<V_PLM_CP_WGGXEntity>();
            if (!string.IsNullOrEmpty(dh))
            {
                expression = expression.And(t => t.ZDH == dh);
            }
            return service.FindEntity(expression);
        }
    }
}